﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using PortalWeb.Core.Entity;
using PortalWeb.I18N;

namespace PortalWeb.Areas.Admin.Models
{
    public class DeleteFunctionViewModel
    {
        public DeleteFunctionViewModel()
        {
        }

        public DeleteFunctionViewModel(Function function)
        {
            Id = function.Id;
            ParentId = function.ParentId;
            Type = function.Type;
            FunctionName = function.Name;
            ActionUrl = function.ActionUrl;
            OperationTime = function.OperationTime;
        }

        public int Id { get; set; }

        public int? ParentId { get; set; }


        [Display(ResourceType = typeof (Resources), Name = "FunctionType")]
        public EnumFunctionType Type { get; set; }


        [Display(ResourceType = typeof (Resources), Name = "FunctionName")]
        public string FunctionName { get; set; }


        [Display(ResourceType = typeof (Resources), Name = "ActionUrl")]
        public string ActionUrl { get; set; }


        [Display(ResourceType = typeof (Resources), Name = "OperationTime")]
        public DateTime OperationTime { get; set; }
    }

    public class EditFunctionViewModel
    {
        public EditFunctionViewModel()
        {
        }

        public EditFunctionViewModel(Function function)
        {
            Id = function.Id;
            ParentId = function.ParentId;
            Type = function.Type;
            FunctionName = function.Name;
            ActionUrl = function.ActionUrl;
            Icon = function.Icon;
            OperationTime = function.OperationTime;
        }

        public int Id { get; set; }

        public int? ParentId { get; set; }

        [Required]
        [Display(ResourceType = typeof (Resources), Name = "FunctionType")]
        public EnumFunctionType Type { get; set; }

        [Display(ResourceType = typeof (Resources), Name = "Operator")]
        public string Operator { get; set; }

        public string Icon { get; set; }

        public bool IsShow { get; set; }

        [Required]
        [Display(ResourceType = typeof (Resources), Name = "FunctionName")]
        public string FunctionName { get; set; }

        [Required]
        [Display(ResourceType = typeof (Resources), Name = "ActionUrl")]
        public string ActionUrl { get; set; }


        [Display(ResourceType = typeof (Resources), Name = "OperationTime")]
        public DateTime OperationTime { get; set; }
    }

    public class NavbarFunctionViewModel
    {
        public int Id { get; set; }

        public int? ParentId { get; set; }

        [Required]
        [Display(ResourceType = typeof (Resources), Name = "FunctionType")]
        public EnumFunctionType Type { get; set; }

        public string Icon { get; set; }

        [Required]
        [Display(ResourceType = typeof (Resources), Name = "FunctionName")]
        public string FunctionName { get; set; }

        [Required]
        [Display(ResourceType = typeof (Resources), Name = "ActionUrl")]
        public string ActionUrl { get; set; }
    }
}